<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title><?php echo ($caption); ?></title>
<link rel="stylesheet" href="/Public/User/css/weui.css"/>
<link rel="stylesheet" href="/Public/User/css/example.css"/>
<script src="/Public/User/js/jquery.js"></script>
<link rel="stylesheet" href="/Public/User/css/swiper.min.css">
<script src="/Public/User/js/swiper.min.js"></script>
<script src="/Public/User/js/pc_dom_tool.js"></script>
<script src="<?php echo $dic;?>"></script>
<script src="<?php echo $pro;?>"></script>
<!-- 二次定义weui样式开始 -->
<style>
    .weui-cell__hd{
        width:40%;
        padding:0px;
    }
    .weui-cell{
        width:60%;
    }
    .weui-cell_vcode{
        width:100%;
    }
    .weui-label{
        width:140px;
        overflow: hidden;
    }
    .operation_div,.operation_div_2{
        padding:18px;
    }
    .weui-input{
        padding-left:20px;
    }
    <?php
 if($dealt==1): ?>
    <?php
 else: ?>
    	.operation_div_2 input{
	        width:23%;
	        margin-right: 2%;
	        display: inline;
	    }
    <?php
 endif; ?>
</style>
<!-- 二次定义weui样式结束 -->
<script>
	//初始化是否审批状态标记
   	var is_dealt = <?php echo $dealt;?>;
    $(function(){
        //检测表单提交数据合法性
		var json = eval(<?php echo $info;?>);
		var is_extension = <?php echo $is_extension;?>;
		//判断是否为可拓展子集
		if(is_extension==0){
		    var data = {
		        name:json.name,
		        action:'/User/Info/edit',
		        method:'post',
		        json:json.sublist,
		        dic:dic,
		        pro_dic:pro_dic
		    };
		    formStart(data);                    
		}else{
		    var data = {
		        name:json.name,
		        action:'/User/Info/edit',
		        method:'post',
		        json:json.sublist,
		        value:json.subvalue,
		        dic:dic,
		        pro_dic:pro_dic,
		    };
		    formStart_sub(data);
		}
	//检测表单提交数据合法性
	var form_flag = false;
	$('form').bind('submit',function(){
		//检测是否已在审批中
		if(is_dealt==1){
			return false;
		}
	    //初始化判断标记
	    var flag = true;
	    //获取当前表单select对象集合
	    var select_list = $(this).find('select');
	    $(select_list).each(function(){
			if($(this).val()=='请选择'){
		  		$('#dialog2').show();
		  		$('#dialog2_msg').html($(this).parent().prev().find('label').html()+'必选!');
		      	flag = false;
		      	return;
			}
		});
	    if(!flag){
	        return false;
	    }
	    if(form_flag==true){
	        return true;
	    }
	    //确认提示框
	    $('#dialog3 .weui-dialog__ft').find('a:eq(0)').bind('click',function(){
		$('#dialog3').hide();
	        form_flag = false;
	    });
	    $('#dialog3 .weui-dialog__ft').find('a:eq(1)').bind('click',function(){
		$('#dialog3').hide();
		form_flag = true;
		$('form').trigger('submit');
		});
		$('#dialog3').show();
		return false;
	})
		//点击取消按钮隐藏alert提示
		$('#dialog2_but').bind('click',function(){
		    $('#dialog2').hide();
		});
		//监听返回首页按钮 返回上一页
		$('.callback_button').bind('click',function(){
		    location.href = "/User/Index/index";
		});
		//节点滑动特特效
		var swiper = new Swiper('.swiper-container', {
		    pagination: '.swiper-pagination',
		    paginationClickable: true,
		});
		//监听新增子集事件
		$('.add_info').bind('click',function(){
		    //获取子集名称
		    var tablename = $('input[name=table_name]').val();
		    var url = "/User/Info/addInfo/menu/"+tablename;
		    location.href = url;
		});
		
		//监听删除子集数据事件
		$('.sub_del').bind('click',function(){
		    //记录数据坐标
		    var offset = $(this).attr('_offset_id');
		    //记录子集名称
		    var tablename = $('input[name=table_name]').val();
		    $('#dialog1').show();
		    $('.weui-dialog a').bind('click',function(){
				var value = $(this).html();
				if(value=='确定'){
				    location.href = "/User/Info/delInfo/tablename/"+tablename+"/id/"+offset;
				}else{
				    $('#dialog1').hide();                       
				}
			});
		});
		
		//初始化form高度
	});
</script>
</head>
<body>
	<div id="dialog3" style="display:none;">
	    <div class="weui-mask"></div>
	        <div class="weui-dialog">
	            <div class="weui-dialog__hd"><strong class="weui-dialog__title">操作提示</strong></div>
	            <div class="weui-dialog__bd">确定要提交吗？
	            </div>
	            <div class="weui-dialog__ft">
	            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
	            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
	            </div>
	        </div>
	    </div>
	</div>
	<div id="dialog1" style="display:none;">
	    <div class="weui-mask"></div>
	        <div class="weui-dialog">
	            <div class="weui-dialog__hd"><strong class="weui-dialog__title">操作提示</strong></div>
	            <div class="weui-dialog__bd">确定要删除吗？
	            </div>
	            <div class="weui-dialog__ft">
	            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
	            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
	            </div>
	        </div>
	    </div>
	</div>
	<div id="dialog2" style="display:none;">
	    <div class="weui-mask"></div>
	        <div class="weui-dialog">
	            <div class="weui-dialog__hd"><strong class="weui-dialog__title">操作提示</strong></div>
	            <div class="weui-dialog__bd" id="dialog2_msg">
	            </div>
	            <div class="weui-dialog__ft">
	            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" id="dialog2_but">好的</a>
	            </div>
	        </div>
	    </div>
	</div>
</body>
</html>